<?php if (!defined('DB_PEREFIX')) exit;

//error_reporting (E_ALL);

print '<ul id="top_nav"><li class="sel"><a href="/admin/">Панель администратора</a></li><li>Журнал ошибок</li></ul>';

if (isset($_GET['clear'])) {
	$file = fopen ("engine/errorlog.txt", "w+");
	fclose ($file);
	site_message ("Журнал ошибок очищен!");
}

include "engine/xml.class.php";

$log = new XML;

$log->xml_file = "engine/errorlog.txt";
$log->cache_file();

$main_array = $log->select_array ("error");

if (count($main_array) == 0) site_message ("Нет записей в журнале ошибок!");
else {
	
	$out = "\n\n<style>._help_ {color:silver;}</style>\n\n";
	
	
	foreach ($main_array as $err) {
		$date = $log->select_from_text ("date", $err);
		$ip = $log->select_from_text ("ip", $err);
		$errno = $log->select_from_text ("errno", $err);
		$type = $log->select_from_text ("type", $err);
		$msg = $log->select_from_text ("msg", $err);
		$url = $log->select_from_text ("urlstring", $err);
		$script = $log->select_from_text ("script", $err);
		$line = $log->select_from_text ("line", $err);
		
		$out .= "\n\t<tr><td><br /><span class=\"_help_\">дата:</span></td><td><br />".$date."</td></tr>".
		"\n\t<tr><td><span class=\"_help_\">ip:</span></td><td>".$ip."</td></tr>".
		"\n\t<tr><td><span class=\"_help_\">номер:</span></td><td>".$errno."</td></tr>".
		"\n\t<tr><td><span class=\"_help_\">тип:</span></td><td>".$type."</td></tr>".
		"\n\t<tr><td><span class=\"_help_\">сообщение:</span></td><td>".$msg."</td></tr>".
		"\n\t<tr><td><span class=\"_help_\">адрес:</span></td><td>".$url."</td></tr>".
		"\n\t<tr><td><span class=\"_help_\">файл:</span></td><td>".$script."</td></tr>".
		"\n\t<tr><td><span class=\"_help_\">линия:</span></td><td>".$line."</td></tr>";
		
	}
	
	past_table ("Журнал ошибок (<a href=\"/admin/?do=show_errorlog&clear=true\">очистить</a>)", "<table>".$out."</table>");
	
	
}



come_back ("панели администратора", "/admin/");
